package FSMDE.controllers.tests.mocks;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

import main.java.FSMDE.infrastructure.IProjectContext;
import main.java.FSMDE.models.Diagram;
import main.java.FSMDE.models.Interface;
import main.java.FSMDE.models.Transition;


public class MockProjectContext implements IProjectContext {

    private static final String SubFolder = "Datos";
	private List<Diagram> contextDiagrams;
    private List<Diagram> globalDiagrams;
	private String name;

	public MockProjectContext(){
		this.contextDiagrams = new ArrayList<Diagram>();
		this.globalDiagrams = new ArrayList<Diagram>();
	}
	
	@Override
	public void addContextDiagram(Diagram diagram) {
		this.contextDiagrams.add(diagram);
	}

	@Override
	public void addProjectDiagram(Diagram diagram) {
		this.globalDiagrams.add(diagram);
	}

	@Override
	public String getName() {
		return this.name;
	}

	@Override
	public void setName(String name) {
		this.name = name;
	}

	@Override
	public String getDataDirectory() {
		if (this.name != null){
			return this.name + "/" + SubFolder;
		}
		
		return null;
	}

	@Override
	public void clearContextDiagrams() {		
		this.contextDiagrams.clear();
	}

	@Override
	public Iterable<Interface> getAllInterfaces() {
		return null;
	}

	@Override
	public Iterable<Interface> getAllInterfaces(Interface interfaceToExclude) {
		return null;
	}

	@Override
	public Iterable<Diagram> getProjectDiagrams() {
		return null;
	}

	@Override
	public Interface getInterface(UUID interfaceId) {
		for (Diagram diagram : this.globalDiagrams)
			for (Interface interface0 : diagram.getInterfaces())
				if (interface0.getId().equals(interfaceId))
					return interface0;
		return null;
	}

	@Override
	public Diagram getContextDiagram(String diagramName) {
		Diagram diagram = new Diagram();
		diagram.setName(diagramName);
		return diagram;
	}

	@Override
	public void clearProjectDiagrams() {
		this.globalDiagrams.clear();
	}

	@Override
	public Iterable<Transition> getAllTransitions() {
		return null;
	}

	@Override
	public Iterable<Transition> getAllTransitions(Transition transitionToExclude) {
		return null;
	}

	@Override
	public void removeDiagram(Diagram diagram) {
	}

	@Override
	public Diagram getDeppestContextDiagram() {
		return null;
	}

}
